package com.xuchen.zhenyang.scheduling;

import com.xuchen.zhenyang.service.StatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
@Slf4j
public class StatisticsScheduling {

    @Autowired
    StatisticsService statisticsService;

    @Scheduled(cron = "0 0 4/2 * * *")
    private void configureTasks() {
        log.info("定时器更新统计数据");
        statisticsService.refreshGoodsSale();
        statisticsService.refreshUserOrder();
        statisticsService.refreshUserDebt();
    }
}
